package com.yntx.usercenter.common.exception;

import com.yntx.usercenter.common.web.Status;
import lombok.Data;

/**
 * 基本运行时异常
 *
 * @author jielihaofeng
 * @date 2022-12-02 12:27
 */
@Data
public class BaseRuntimeException extends RuntimeException {

    private Integer code;

    private String[] msgParam;

    public BaseRuntimeException(Integer code, Throwable cause) {
        super(String.valueOf(code), cause);
        this.code = code;
    }

    public BaseRuntimeException(Status status) {
        super(status.getMessage());
        this.code = status.getCode();
    }

    public BaseRuntimeException(Integer code, String msgParam, Throwable cause) {
        super(msgParam, cause);
        this.code = code;
        this.msgParam = new String[1];
        this.msgParam[0] = msgParam;
    }

    public BaseRuntimeException(Integer code, String[] msgParams, Throwable cause) {
        super(String.valueOf(msgParams), cause);
        this.code = code;
        this.msgParam = msgParams;
    }


}
